//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "ProcessCathFASTAProfile.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  String* namefileFASTAProfileIn   = NULL;
  String* namefileFASTAProfileSSIn = NULL;
  String* namefileFASTAProfileOut  = NULL;

  if (argc < 4) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./ExpandRepeatSequenceFASTAProfile <Profile FASTA File with repeat Sequences> <Profile FASTA File without repeat Sequences> <Profile FASTA File Out>" << endl;
    
    return 0;
    
  }
  else {
    
    namefileFASTAProfileIn   = new String(argv[1]);
    namefileFASTAProfileSSIn = new String(argv[2]);
    namefileFASTAProfileOut  = new String(argv[3]);
    
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << " Profile FASTA File In without SS : " << argv[1] << endl;
    cout << "    Profile FASTA File In whit SS : " << argv[2] << endl;
    cout << "           Profile FASTA File Out : " << argv[3] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    
  }
  
  ProcessCathFASTAProfile* processCathFASTAProfile = new ProcessCathFASTAProfile ();
  
  cout << "Preparing Files..." << endl;
  processCathFASTAProfile->NamefileIn(namefileFASTAProfileIn);
  processCathFASTAProfile->NamefileOut(namefileFASTAProfileOut);
  
  cout << "Loading Profile FASTA File with Domain Descriptions..." << endl;
  processCathFASTAProfile->LoadData();
  
  cout << "Number of Domains (repeat Seq) : " << processCathFASTAProfile->ListCathDomainProfile()->Length() << endl;
  
  cout << "Expanding the information of repeated sequences..." << endl;
  processCathFASTAProfile->ExpandDuplicatedDataSecondaryStructure(namefileFASTAProfileSSIn);
  
  cout << "Writing the Out File..." << endl;
  processCathFASTAProfile->OutFilterFile();
  
  cout << "Finished..." << endl << "Good Bye" << endl;
  
  if (processCathFASTAProfile)   delete processCathFASTAProfile;
  
  if (namefileFASTAProfileIn)    delete namefileFASTAProfileIn;
  if (namefileFASTAProfileSSIn)  delete namefileFASTAProfileSSIn;
  if (namefileFASTAProfileOut)   delete namefileFASTAProfileOut;

  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

